use axum::routing::{delete, get, put};
use axum::{routing::post, Router};

use crate::bootstrap::AppState;
use crate::controller::user::address_book;

pub fn addressbook_router(state: &AppState) -> Router<AppState> {
    let router = Router::new()
        .route("/", post(address_book::save)) // warn
        .route("/", put(address_book::update)) //warn
        .route("/", delete(address_book::delete_by_id))
        .route("/:id", get(address_book::get_by_id))
        .route("/list", get(address_book::list))
        .route("/default", get(address_book::get_default))
        .route("/default", put(address_book::set_default))
        .with_state(state.clone());

    router
}
